//! \file lockobject.hpp
//! \brief Purewell Library Lock Header
//! \author Yubin Lim (purewell@gmail.com)
//! \since 2008-01-25

#ifndef __PWHDR_LOCKOBJECT_HPP__
#define __PWHDR_LOCKOBJECT_HPP__

#include "threadobject.hpp"

namespace purewell
{

//! \brief Lock object
class PWAPI PWLockObject : public PWThreadObject
{
public:
	//! \brief Lock(wait).
	virtual void lock(void) = 0;

	//! \brief Try to lock(wait).
	//! \return On success, true.
	virtual bool lockTest(void) = 0;

	//! \brief Try to lock(wait) in time.
	//! \param[in] msec Time to wait. Unit is millisecond.
	//! \return On success, true.
	virtual bool lockTimeLimit(size_t msec) = 0;

	//! \brief Unlock.
	virtual void unlock(void) = 0;

protected:
	explicit PWLockObject();
	virtual ~PWLockObject();

};//PWLockObject

};//namespace purewell

#endif//!__PWHDR_LOCKOBJECT_HPP__

